package org.ndx.majick.ui;

import javax.swing.JComponent;

import org.ndx.majick.properties.Property;

/**
 * Provide all interface components for a specific bean property data class
 * @author Nicolas Delsaux
 *
 */
public interface IClassUIProvider {

	/**
	 * Creates metadata required to use this provider
	 * @return
	 */
	IPropertyUIMetadata createMetadata();

	/**
	 * Gets editor component.
	 * This component is binded to property, allowing modifications made to property to be directly reflected 
	 * to editor, and reciprocally
	 * @param metadata property metadata
	 * @param source edited property
	 * @return editor component
	 */
	JComponent getEditor(IPropertyUIMetadata metadata, Property<?> source);

	/**
	 * Gets viewer component.
	 * This component is binded to property, ensuring property modifications are relected in UI. But this 
	 * viewer do not allow edition of property value.
	 * @param metadata property metadata
	 * @param source viewed property
	 * @return viewer component
	 */
	JComponent getViewer(IPropertyUIMetadata metadata, Property<?> source);

}
